<form class="form-horizontal" id="winModal">
    <input id="id" name="id" type="hidden">
    <div class="form-group">
        <label class="col-sm-3 control-label text-left">流程名称：</label>
        <div class="col-sm-8">
            <input id="flowName" name="flowName" class="form-control" type="text" placeholder="请输入流程名称">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label text-left">事项编码：</label>
        <div class="col-sm-8">
            <input id="itemCode" name="itemCode" class="form-control" type="text" placeholder="请输入事项编码">
        </div>
    </div>
</form>
<script type="text/javascript">
    $(function () {
        var e = "<i class='fa fa-times-circle'></i>";
        $("#winModal").validate({
            rules: {
                flowName: {
                    required: true,
                    rangelength: [2, 30],
                    remote: {
                        url: "check.json",
                        type: "post",
                        data: {
                            flowName: function () {
                                return $("#flowName").val();
                            },
                            id: function () {
                                return $("#id").val();
                            }
                        }
                    }
                },
                itemCode: {
                    required: true,
                    rangelength: [2, 100],
                    remote: {
                        url: "check.json",
                        type: "post",
                        data: {
                            itemCode: function () {
                                return $("#itemCode").val();
                            },
                            id: function () {
                                return $("#id").val();
                            }
                        }
                    }
                }
            },
            messages: { //自定义验证消息
                flowName: {
                    required: e + "请输入流程名称",
                    rangelength: $.validator.format(e + "流程名称位数要在{0}-{1}个字符之间。"),
                    remote: $.validator.format(e + "流程名称“{0}”已经被占用。")
                },
                itemCode: {
                    required: e + "请输入流程代码",
                    rangelength: $.validator.format(e + "代码路径位数要在{0}-{1}个字符之间。"),
                    remote: $.validator.format(e + "代码路径“{0}”已经被占用。")
                }
            }
        });
    });
</script>